/* for vsnprintf() and va_list */
#include <stdio.h>

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif

#include <windows.h>	// for OutputDebugString()

#include "../mylib/globalDefines.h"
#include "../mylib/dbg_logging.h"

#if (NDEBUG)
#include <assert.h>
#endif

/* printf debug formatted output */
int VDebugPrintF( const char* format, va_list argList )
{
	const uint32 MAX_CHARS = 1023;
	static char s_buffer[ MAX_CHARS + 1 ];

	int charsWritten = vsnprintf( s_buffer, MAX_CHARS, format, argList );
	s_buffer[ MAX_CHARS ] = '\0';

	OutputDebugString( s_buffer );

	return charsWritten;
}

int DebugPrintF( const char* format, ... )
{
	va_list argList;
	va_start(argList, format);

	int charsWritten = VDebugPrintF( format, argList );

	va_end(argList);

	return charsWritten;
}

/* if expression equals to zero(false), assert is triggered */
#if (NDEBUG)

void Framework_Assert(int expression)
{
	assert(expression);
}

#else

ME_INLINE void Framework_Assert(int expression)
{}

#endif